package cn.mzcode.xyzpfuwuduan.common;

import com.google.common.collect.Sets;

import java.util.Set;

public class Const {

    public static final String CURRENT_USER="currentUser";

    public static final String EMAIL="email";
    public static final String USERNAME="username";
    public static final String PHONE="phone";
    public interface ProductListOrderBy{
        Set<String> PRICE_ASC_DESC= Sets.newHashSet("price_desc","price_asc");
    }

    public enum  OrderStatusEum{
         NO_PAY(0,"未付款");
         private String value;
         private int code;

        OrderStatusEum(int code, String value) {
            this.value = value;
            this.code = code;
        }
        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }

        public static OrderStatusEum codeOf(int code){
            for (OrderStatusEum orderStatusEum:values()){
                if (orderStatusEum.getCode()==code){
                    return orderStatusEum;
                }
            }
            throw new RuntimeException("没有找到对应的枚举");
        }
    }

    public interface Cart{
        int CHECKED=1; //购物车选中状态
        int UN_CHECKED=0;//购物车未选中状态

        String LIMIT_NUM_FALE="LIMIT_NUM_FALE";
        String LIMIT_NUM_SUCCESS="LIMIT_NUM_SUCCESS";
    }

    public interface Role{
        int ROLE_CUSTOMER=0;//普通用户；
        int ROLE_ADMIN=1;//管理员
    }

    public enum ProductStatusEnum{
        ON_SALE(1,"在线");
        private String value;
        private int code;
        ProductStatusEnum(int code,String value){
            this.code=code;
            this.value=value;
        }

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }
    }

    public enum PaymentTypeEnum{
        ONLINE_PAY(1,"在线支付");
        private String value;
        private int code;
        PaymentTypeEnum(int code,String value){
            this.code=code;
            this.value=value;
        }

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static PaymentTypeEnum codeOf(int code){
            for (PaymentTypeEnum paymentTypeEnum:values()){
                if (paymentTypeEnum.getCode()==code){
                    return paymentTypeEnum;
                }
            }
            throw new RuntimeException("没有找到对应的枚举");
        }
    }



}
